package com.tongna.service;

import com.tongna.dao.TenantDao;
import com.tongna.domain.Tenant;
import com.tongna.util.DBUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * TenantDemo
 *
 * @author 张浩伟
 * @version 1.01 2018年02月09日
 */
@Service
public class TenantService {


    @Autowired
    private TenantDao dao;

    public List<Tenant> findAll() {
        return dao.findAll();
    }

    public void add(Tenant tenant) {
        boolean success = DBUtils.createDataBases(tenant.getHost());
        dao.add(tenant);
    }

    public Tenant findOne(Long id) {
        return dao.findOne(id);
    }

}
